<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <input type="text" placeholder="请输入一个两位数" />
    <button>点击判断</button>
  </body>
</html>
<script>
  var ipt = document.querySelector("input");
  var btn = document.querySelector("button");
  btn.onclick = function () {
    if (ipt.value.trim() == "") return alert("请输入内容");
    if (isNaN(ipt.value)) return alert("请输入数字");
    if (
      ipt.value / 7 == 0 ||
      (ipt.value % 10) / 7 == 1 ||
      parseInt(ipt.value / 10) % 7 == 0
    ) {
      alert(ipt.value + "能被7整除或者包含七");
    } else {
      alert(ipt.value + "不能被整除切不包含7");
    }
  };
</script>
